# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @Project   :template 
# @FileName  :xml_rpc.py
# @Time      :2023/12/1 17:11
# @Author    :zxc19
# @IDE       :PyCharm
# @DESC      :
import random
import time
from xmlrpc.server import SimpleXMLRPCServer


def get_time():
    time.sleep(random.random())
    return time.time()


def get_random_number(low, high):
    time.sleep(random.random())
    return random.randint(low, high)


def show():
    return 'show'


server = SimpleXMLRPCServer(("localhost", 8877))
print("Listening on port 8877...")
server.register_function(get_time, "get_time")
server.register_function(get_random_number, "get_random_number")
server.register_function(show, "show")
server.serve_forever()
